#pragma once

#include "vrdatacore_global.h"
#include "remarkactorbase.h"
#include "commonshape.h"
#include <osg\Billboard>

namespace VrDataCore
{
	class BeamCallback;

	class VRDATACORE_EXPORT BeamActor:public RemarkActorBase
	{
	public:
		BeamActor();

		virtual void buildPropertyMap();
	protected:
		~BeamActor();
		virtual void createDrawable();

		osg::ref_ptr<osg::Billboard>						_billboard;
		osg::ref_ptr<CoreBase::CommonCylinder>				_outDrawable;
		osg::ref_ptr<CoreBase::CommonCylinder>				_centerDrawable;
		osg::ref_ptr<BeamCallback>							_uniformInCallback;
		osg::ref_ptr<BeamCallback>							_uniformcenterCallback;
		osg::ref_ptr<BeamCallback>							_uniformOutCallback;
	};

	class BeamCallback : public osg::Uniform::Callback
	{
	public:
		BeamCallback():_times(0.0f)
		{}
		~BeamCallback(){};
		virtual void operator()(osg::Uniform* uniform, osg::NodeVisitor* nv)
		{
			uniform->set(_times);
			_times++;
		}
		void reset(){_times = 0.0f;}
	protected:
		float							_times;
	};
}